From 211b5dbdda47c4bb19f3ebc274253b21e1b81bc4 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 8 Dec 2025 01:46:14 +0900
Subject: (김준회) 서버사이드 페칭 예시 소팅 오류 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/[lng]/test/table-v2/page.tsx | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'app/[lng]/test/table-v2/page.tsx')

diff --git a/app/[lng]/test/table-v2/page.tsx b/app/[lng]/test/table-v2/page.tsx
index e7fb5bdd..65c0ee1d 100644
--- a/app/[lng]/test/table-v2/page.tsx
+++ b/app/[lng]/test/table-v2/page.tsx
@@ -99,6 +99,8 @@ function ClientSideTable() {
               enablePagination
               enableGrouping
               height="100%"
+              enableUserPreset={true}
+              tableKey="test-table-v2-pattern1"
             />
           </div>
         </LoadingOverlay>
@@ -188,6 +190,8 @@ function FactoryServiceTable() {
               onColumnFiltersChange={setColumnFilters}
               globalFilter={globalFilter}
               onGlobalFilterChange={setGlobalFilter}
+              enableUserPreset={true}
+              tableKey="test-table-v2-pattern-2-A"
             />
           </div>
         </LoadingOverlay>
@@ -208,6 +212,7 @@ function ServerGroupingTable() {
   const [isGrouped, setIsGrouped] = React.useState(false);
   const [isLoading, setIsLoading] = React.useState(true);
   const [totalRows, setTotalRows] = React.useState(0);
+  const [sorting, setSorting] = React.useState<SortingState>([]);
 
   const [pagination, setPagination] = React.useState<PaginationState>({
     pageIndex: 0,
@@ -220,7 +225,7 @@ function ServerGroupingTable() {
       setIsLoading(true);
       try {
         const result = await getProductTableDataWithGrouping(
-          { pagination, grouping },
+          { pagination, grouping, sorting },
           expandedGroups
         );
         
@@ -242,7 +247,7 @@ function ServerGroupingTable() {
     };
 
     fetchData();
-  }, [pagination, grouping, expandedGroups]);
+  }, [pagination, grouping, sorting, expandedGroups]);
 
   // 그룹 토글
   const toggleGroup = (groupKey: string) => {
@@ -374,6 +379,8 @@ function ServerGroupingTable() {
                 height="400px"
                 pagination={pagination}
                 onPaginationChange={setPagination}
+                sorting={sorting}
+                onSortingChange={setSorting}
                 // 그룹핑 상태 연결
                 grouping={grouping}
                 onGroupingChange={handleGroupingChange}
-- 
cgit v1.2.3

